<?php
    /**
    *file-level documentation
    *@author El-Hindi, Feil, Ziegler <goatymail@googlemail.com>
    *27 May 2012
    *@copyright Copyrigth (c) 2012, Tuncay Bakan
    *@package root
    *
    */
    /**
    *
    */
    include_once ('../config.inc.php');
    include_once (WEBSITE_ROOT . 'lib/router.class.php');
    include("Mobile_Detect.php");
    $oDetect = new Mobile_Detect();
    //echo phpinfo();
    //get the viewmanager instance
    $oViewmanager = Viewmanager::getInstance();
    
    //set the layout of the page with the viewmanager
   if (isset($_GET['a'])){ 
       if($_GET['a']== 'ajax'){
            Router::route($_GET);
           }
   }else{
       
       if($oDetect->isMobile()){
       
            $oViewmanager->_setLayout(MOBILE_LAYOUT);
            $oViewmanager->_setCSS(MOBILE_CSS);
            $GLOBALS['NAVIGATIONTEMP'] = 'navigationMobile';
            if($GLOBALS['ISMOBILE'] != 1){
                //define('ISMOBILE', 1);
                $GLOBALS['ISMOBILE'] = 1;
            }
       }else{
            $oViewmanager->_setLayout(LAYOUT);
            $oViewmanager->_setCSS(CSS);
            $GLOBALS['NAVIGATIONTEMP'] = 'navigation';
        }
        //call the static route method of the Router class to call the rigth controller
        Router::route($_GET);
   }

    
    //show the webpage
    $oViewmanager->load();
    
    
    function __autoload($sClassName){
        Loader::loadClass($sClassName);
    }
?>